package cs4280.ass2.util;

import org.apache.commons.lang.StringUtils;

import cs4280.ass2.entity.Schedule;
import cs4280.ass2.exception.ValidateException;

public class ScheduleUtils {
	
	public static void validate(Schedule schedule) throws ValidateException {
		if (schedule.getMovieId() < 0L) {
			throw new ValidateException("message.error.validate.scheduleSeatDetail.movieId.negativeValue");
		}
		if (schedule.getHouseId() < 0L) {
			throw new ValidateException("message.error.validate.scheduleSeatDetail.houseId.negativeValue");
		}
		if (schedule.getPrice() < 0L) {
			throw new ValidateException("message.error.validate.scheduleSeatDetail.price.negativeValue");
		}
		if (StringUtils.isBlank(schedule.getScheduleStart().toString())) {
			throw new ValidateException("message.error.validate.scheduleSeatDetail.scheduleStart.empty");
		}
		if (StringUtils.isBlank(schedule.getScheduleEnd().toString())) {
			throw new ValidateException("message.error.validate.scheduleSeatDetail.scheduleEnd.empty");
		}
	}
	
}
